#!groovy

@Library("jenkinslibrary@master") _ 

String stackName = "${env.stackName}"
String releaseVersion = "${env.releaseVersion}"

def gitlab = new org.devops.gitlab()
def k8s = new org.devops.kubernetes()

pipeline{
   agent { node { label "build" }}
   
   stages{
   
       stage("Deploy"){
            steps{
                script{
                
                    //获取版本文件
                    stack = "${stackName}".toLowerCase()
                    response = gitlab.GetRepoFile(7,"demo-${stack}%2f${releaseVersion}-${stack}.yaml")
                    //发布应用
                    k8s.UpdateDeployment("demo-${stack}","demoapp",response)
 
                }  
           }
       }
   }
}